using WebApplication1.Implement.DTO;

namespace WebApplication1.Implement.IServices
{
    /// <summary>
    /// AI服务接口
    /// </summary>
    public interface IAIService
    {
        /// <summary>
        /// 发送消息到AI模型并获取回复
        /// </summary>
        /// <param name="message">用户消息</param>
        /// <param name="conversationHistory">对话历史</param>
        /// <param name="systemPrompt">系统提示词</param>
        /// <returns>AI回复</returns>
        Task<string> GetAIResponseAsync(string message, List<ChatHistoryItem>? conversationHistory = null, string? systemPrompt = null);

        /// <summary>
        /// 检查AI服务是否可用
        /// </summary>
        /// <returns>是否可用</returns>
        Task<bool> IsAvailableAsync();

        /// <summary>
        /// 获取当前使用的AI模型名称
        /// </summary>
        /// <returns>模型名称</returns>
        string GetModelName();
    }

    /// <summary>
    /// 对话历史项
    /// </summary>
    public class ChatHistoryItem
    {
        public string Role { get; set; } = string.Empty; // "user" 或 "assistant"
        public string Content { get; set; } = string.Empty;
        public DateTime Timestamp { get; set; } = DateTime.Now;
    }
}
